﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="report.aspx.cs" Inherits="Xiaov.SmartWeb.Application.SZBBTree.report" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Resources/easyui-1.32/themes/default/easyui.css" rel="stylesheet"
        type="text/css" />
    <link href="../Resources/easyui-1.32/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../Resources/easyui-1.32/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../Resources/easyui-1.32/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../binary/dynaload.js?50" type="text/javascript"></script>
    <script type="text/javascript" language="JavaScript">
        function OnReady(id) {
//            form1.AF.func("Build", "InitTable.aspx?tableName=CL0018&dwbm=HG&nf=2014&yf=8");
            ReloadGrid();

//            form1.AF.func("MergeSame", "col=4");
        }

        function ReloadGrid() {
            var tableName = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var nf = $('#ddlNF').val();
            var yf = $('#ddlYF').val();
            form1.AF.func("Build", "InitTable.aspx?tableName=" + tableName + "&dwbm=" + dwbm + "&nf=" + nf + "&yf=" + yf);
            form1.AF.func("Load", "InitTableData.aspx?tableName=" + tableName + "&dwbm=" + dwbm + "&nf=" + nf + "&yf=" + yf);
//            SetGridPro();
            //            form1.AF.func("Build","t2.xml");
        }

        function SetGridPro() {
            var nf = $('#ddlNF').val();
            var tableName = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            $.ajax({
                type: "post",
                url: "GetLockCell.aspx",
                dataType: "json",
                data: { nf: nf, tableName: tableName, dwbm: dwbm },
                success: function (data) {
                    var jsonData = data;
                    lockgridcell(jsonData.lockcell);
                    hidegridRow(jsonData.hiderow);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        }
        function hidegridRow(hiderow) {
            var rows = form1.AF.func("GetRows", "");
            //                alert(hiderow);
            for (var i = 0; i < rows; i++) {
                var zbbm = form1.AF.func("GetCellData", i + "\r\n1");
                //                hiderow = "CL0001";
                if (hiderow != "") {
                    if (hiderow.indexOf(zbbm) >= 0) {
                        form1.AF.func("HideRow", i + "\r\ntrue");
                    }
                }
            }
        }
        function lockgridcell(lockcell) {
            if (lockcell == 0)
            { }
            else {
                var str = lockcell, a = [], b = [], c = [], d = [], temp = str.split("|"), i = 0;
                //将字符串用"|"符号分割后存入 temp数组
                for (; i < temp.length; i++) {
                    a.push(temp[i].split(",")[0]); //列
                    b.push(temp[i].split(",")[1]);
                    c.push(temp[i].split(",")[2]); //行
                    d.push(temp[i].split(",")[3]);
                }
                //            alert(a.join(",") + "\n" + b.join(",")); //将a,b数据元素用","链接，alert出来测试最后结果。
                for (var j = 0; j < a.length; j++) {
                    form1.AF.func("SetCellBackColor", c[j] + "\r\n" + a[j] + "\r\n#C0FFFF");
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="height: 26px; font-size: 12px;">
        单位：<asp:DropDownList ID="ddlDW" runat="server" AutoPostBack="true">
        </asp:DropDownList>
        时间：
        <asp:DropDownList ID="ddlNF" runat="server" AutoPostBack="true">
        </asp:DropDownList>
        <asp:DropDownList ID="ddlYF" runat="server" AutoPostBack="true">
        </asp:DropDownList>
    </div>
    <div id="p" class="easyui-panel" title="<%=modelXml.Title %>" style="width: auto;
        height: 70px; padding: 10px;">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',disabled:true">
            新增子节点</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove',disabled:true">
                删除行</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'"
                    onclick="save()">保存</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'"
                        onclick="ClearReport()">清空</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="Compute()">表内计算</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',disabled:true">
                                表间提取</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-sum',disabled:<%=sum %>"
                                    onclick="Sum()">分级汇总</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-redo',disabled:true">
                                        继承</a>
    </div>
    <div style="position: relative; width: 96%; height: 700px">
        <script>            insertTreeList('AF', 'Border=single; borderColor=red')</script>
    </div>
    </form>
</body>
</html>
